<!DOCTYPE html>
<meta charset="utf-8" />
<link rel="stylesheet" href="ace_v1.3/assets/css/ui.jqgrid.css" />

<div class="search_panel">
<form action="mpamng/notice/queryNoticeList.do" method="post" onsubmit="return pageSearch(this);">
	<div style="display: block;" class="widget-body ">
		<div class="widget-main">
			<div class="rowt">
				<div class="col-sm-12">
					<div>
					<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">公告标题:</label>
							<div class="search_input">
								<input id="noticeTitle" type="text" name="noticeTitle" placeholder="请输入发送内容">
							</div>
						</div>
					<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">公告内容:</label>
							<div class="search_input">
								<input id="noticeBody" type="text" name="noticeBody" placeholder="请输入发送内容">
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">公告平台:</label>
							<div class="search_input">
							<select 
		rel="obj.NOTICE_PLATFORM"
						location="local" 
		 name="noticePlatform" 
		 id="search_noticePlatform" 
		 data-placeholder="请选择公告平台" 
		  style="width: 120px;vertical-align:middle;">
							<option value="">---请选择---</option>
						 </select>
							</div>
						</div>
						
						<div class="search_elm">
							<button class="btn btn-small btn_search" type="submit" title="搜索" >
								搜索
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	</form>
</div>
	<div class="row">
		<div class="col-xs-12">
			<table id="grid-table"></table>
			<div id="grid-pager"></div>
			
			<div style="margin-top: 10px">
				 <span id="paging_bar" style="float: right"> </span>
			</div>
			<!-- PAGE CONTENT ENDS -->
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->

	<!-- page specific plugin scripts -->
	<script type="text/javascript">
	var jqGrid;
	jQuery(function($) {
		var grid_selector = "#grid-table";
		var pager_selector = "#grid-pager";

		$(window).on(
				'resize.jqGrid',
				function() {
					$(grid_selector).jqGrid('setGridWidth',$(".page-content").width());
				})
		jQuery(grid_selector).jqGrid({
			url : "mpamng/notice/queryNoticeList.do",
			datatype : "json",
			height : '100%',
			width : '100%',
			colNames : [ '公告ID','公告平台  ','公告标题','公告内容','公告发布人','公告发布时间','公告更新人','公告更新时间','操作' ],
			colModel : [   {name : 'noticeId',        index : 'noticeId',   hidden:true,     width : '200px',sortable:false }, 
						     {name : 'noticePlatform',        index : 'noticePlatform',        width : '100px',sortable:false,ditcKey:'NOTICE_PLATFORM' ,formatter : gridFormatByDict }, 
						     {name : 'noticeTitle',        index : 'noticeTitle',        width : '100px',sortable:false }, 
						     {name : 'noticeBody',        index : 'noticeBody',        width : '500px',sortable:false }, 
						     {name : 'noticeIssue',        index : 'noticeIssue',        width : '100px' ,sortable:false}, 
						     {name : 'noticeIssueDate',        index : 'noticeIssueDate',        width : '150px',sortable:false,formatter : gridFormatByDate }, 
						     {name : 'createUserId',        index : 'createUserId',        width : '100px',sortable:false }, 
						     {name : 'createDate',        index : 'createDate',        width : '150px',sortable:false,formatter : gridFormatByDate } ,
						     {name : '',        index : '',        width : '100px',formatter:operateEdit } 
			            ],
			viewrecords : true,
			rowNum : 10,
			rowList : [ 10, 20, 30 ],
			altRows : false,

			shrinkToFit : false,
			multiselect : false,//设置行可多选的 
			multiboxonly : false,//

			loadComplete : function() {
				var table = this;
				setTimeout(function() {
					//加载分页
					initPagingBar(grid_selector);
				}, 0);
			},
			beforeRequest : function() {//请求之前执行
				jqGrid = this;
			},
		});
		$(window).triggerHandler('resize.jqGrid');

		$(document).one('ajaxloadstart.page', function(e) {
			$(grid_selector).jqGrid('GridUnload');
			$('.ui-jqdialog').remove();
		});
		
		function operateEdit(cellvalue, options, rowObject){//定义button按钮
			var button = "<div class=\"hidden-sm hidden-xs btn-group\">";  
				button += "<button class='btn btn-xs btn-warning' onclick='selectNotice(\""+rowObject["noticeId"]+"\")'"   
				 +"title='详细信息查看'>详细</button>";
			return button;
		};
		
		
	});
	
	function selectNotice(noticeId){
		if(noticeId.length<=0){
			msg.alert("警告", "当前没有选择数据项！", "error");
			return;
		}
		openDialog({
			dialogId : 'dlg-NoticeView',
			title : '公告详情列表',
			pageUrl :'mpamng/notice/NoticeDetailView.do',
			dataUrl : 'mpamng/notice/queryNoticeById.do',
			width : '90%',
		    height:'90%',
			dataParam : {
				noticeId : noticeId
			},
			pageParam: {
				type:'view'
			},
			dataName : 'obj,map'//表单数据存储对象名称

		}); 
	}
	</script>